package com.yeyks.controller.platform;

import com.yeyks.account.dal.domain.AccountInfo;
import com.yeyks.common.appcommon.dto.platform.AppFishBallGoodsDTO;
import com.yeyks.common.appcommon.dto.account.AppAccountDTO;
import com.yeyks.common.appcommon.param.platform.QueryFishBallGoodsParam;
import com.yeyks.common.appcommon.result.CommonPage;
import com.yeyks.common.appcommon.result.CommonResult;
import com.yeyks.common.utils.apputil.bean.MyBeanUtils;
import com.yeyks.commonReference.service.consumer.FishBallGoodsService;
import com.yeyks.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author: gui
 * @date: 2019/5/29 0029 19:57
 */
@Api(tags = "AppFishBallController_鱼宝中心接口",description = "鱼宝中心的相关接口信息")
@RestController
@RequestMapping("/platform/fishBall")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AppFishBallController extends BaseController {

    private final FishBallGoodsService fishBallGoodsService;

    @ApiOperation("分页查询鱼宝商品列表")
    @PostMapping("/list")
    public CommonResult<CommonPage<AppFishBallGoodsDTO>> list(@Valid QueryFishBallGoodsParam param){

        AppAccountDTO appAccountDTO = validToken(param.getToken(), param.getVersion(), param.getPlatform());

        return fishBallGoodsService.selectPageByParam(param, MyBeanUtils.convert(appAccountDTO, AccountInfo.class));
        //return fishBallGoodsService.list(param);
    }

}
